package com.zte.springboot_smbms.service.impl;

import com.zte.springboot_smbms.mapper.SmbmsRoleMapper;
import com.zte.springboot_smbms.pojo.SmbmsRole;
import com.zte.springboot_smbms.service.RolesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class RolesServiceImpl implements RolesService {
    @Autowired
    private SmbmsRoleMapper smbmsRoleMapper;
    @Override
    @Transactional(readOnly = true)
    public List<SmbmsRole> findAllRole() {
        return smbmsRoleMapper.findAllRole();
    }

    @Override
    @Transactional(readOnly = true)
    public List<SmbmsRole> findRoleById(Long id) {
        return smbmsRoleMapper.findRoleById(id);
    }

    @Override
    @Transactional(readOnly = false)
    public boolean addRole(SmbmsRole role) {
        return smbmsRoleMapper.addRole(role);
    }

    @Override
    @Transactional(readOnly = false)
    public boolean delRole(Long id) {
        return smbmsRoleMapper.delRole(id);
    }

    @Override
    @Transactional(readOnly = false)
    public boolean updateRole(Long Id, SmbmsRole role) {
        return smbmsRoleMapper.updateRole(Id,role);
    }
}
